#include "common.hpp"

void ori()
{
    key_t k = GetKey();
    cout << "client key:" << k << endl;

    // 获取共享内存
    int shmid = getShm(k, gsize);
    cout << "client shmid:" << shmid << endl;

    // 与共享内存关联
    char *start = attachshm(shmid);

    // 与共享内存断联
    detachshm(start);

    // 用户端无需关闭共享内存
}

void init()
{
    Init init(CLIENT);
    char *start = init.getStart();
    char c = 'A';

    while (c <= 'Z')
    {
        start[c - 'A'] = c;
        c++;
        start[c - 'A'] = '\0';
        sleep(1);
    }
}

int main()
{
    //ori();//不采用类封装
    init();//类封装测试

    return 0;
}